/**
 * Created by hjqi on 2016/2/12.
 */

var gitHandleMap = {};
var github = require('./github');
var bitbucket = require('./bitbucket');

function getGitHandle(type){

    if(gitHandleMap[type] === undefined){
        var obj = undefined;
        switch (type)
        {
            case 'github':
                obj= new github();
                break;
            case 'bitbucket':
                obj=new bitbucket();
                break;
            default:
                ;
        }

        if(obj !== undefined)
            gitHandleMap[type] = obj;

        return obj;
    }else
        return gitHandleMap[type];
}

exports.getGitHandle = getGitHandle;